package org.bigjava.user.util;

import lombok.Data;

@Data
public class PageUtil {

    private int totalCount; //总共的条数

    private int pageSize; //每页显示的条数

    private int sumPage; //总页数

    private int currPage; //当前页数

    private int start; //当前页起始坐标;


    //获取总页数
    public int getSumPage() {
        if (this.getTotalCount() % this.getPageSize() == 0) {
            return (this.getTotalCount() / this.getPageSize());
        }
        return (this.getTotalCount() / this.getPageSize() + 1);
    }

    //当前页码起始下标（数据库）
    public int getStart() {
        return (this.getCurrPage() - 1) * this.getPageSize();
    }

    //
}
